﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Main.Common
{
    public static class ControlExtensions
    {
        public static bool Has<T>(this Control.ControlCollection collection)
        {
            return Find<T>(collection) != null;
        }

        public static Control Find<T>(this Control.ControlCollection collection)
        {
            foreach (Control c in collection)
            {
                if (c is T)
                {
                    return c;
                }
            }
            return null;
        }
    }
}
